import util from '@/libs/util';
export default {
    data () {
        return {
            columns: [{
                title: ' ',
                key: 'radio',
                width: 50,
                render: (h, params) => {
                    return h('Radio', {
                        props: {
                            'value': params.row.id === this.classRoom.id
                        }
                    }, '');
                }
            }, {
                title: '教室名称',
                key: 'name'
            }, {
                title: '所属区域',
                key: 'areaName'
            }, {
                title: '所在楼名',
                key: 'buildName'
            }, {
                title: '座位数量',
                key: 'setAmount'
            }],
            queryData: {},
            dataList: [],
            pageSize: 15,
            pageIndex: 0,
            total: 0,
            areaList: [],
            classRoom: {},
            classRoomSelected:{}
            // dataListSchedule:[],
            // bathAddClassRoomData:{
            //     classRoomName:'',
            //     classRoomId:'',
            // },
        };
    },
    mounted () {
        this.init();
    },
    methods: {
        init: function () { // 页面初始化
            this.doQuery();
        },
        doQuery: function () {
            let queryData = this.queryData;
            queryData.page = this.pageIndex;
            queryData.size = this.pageSize;
            util.ajax.post('/base/classroom/list', util.toFormData(queryData)).then(res => {
                if (res.data.data) {
                    this.dataList = res.data.data.list;
                    this.total = res.data.data.total;
                }
            });
        },
        setRow: function (row, index) {
            this.classRoom = row;
            this.classRoomSelected.id = row.id;
            this.classRoomSelected.name = row.name;
            // if (flag == 1) {
            //     if (index || index == 0) {
            //         var obj = this.dataListSchedule[index];// 当前课表焦点
            //         obj.classRoomId = row.id;
            //         obj.classRoom = row.name;
            //     }
            // } else if (flag = 2) {
            //     this.bathAddClassRoomData.classRoomName = row.name;
            //     this.bathAddClassRoomData.classRoomId = row.id;
            // }
        }
    }
};
